﻿

var xmlHttpReq;
function AjaxPost(url,postdata)
{
    xmlHttpReq=init();
    //修改URL
    var random = parseInt(100*Math.random());
    url = url+"?r="+random;
    xmlHttpReq.open("POST",url,false);
	xmlHttpReq.onreadystatechange=processResponse;
	xmlHttpReq.setRequestHeader("Method", "POST " + url + " HTTP/1.1");
	xmlHttpReq.setRequestHeader("Content-Length",postdata.length);
	xmlHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlHttpReq.send(postdata);

}



function init(){
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} 
	else if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}

function processResponse(){
	if(xmlHttpReq.readyState==4){
		if(xmlHttpReq.status==200){
			updateTable();
		}
		else{
			alert("您请求的页面有异常!")
		}
	}
}



function innerText(node) {  
	if (node.nodeType == 3 || node.nodeType == 4) {
	        return node.data;    
	}
	var i;    
	var returnValue = [];    
	for (i = 0; i < node.childNodes.length; i++) {
	        returnValue.push(innerText(node.childNodes[i]));    
	}    
	return returnValue.join('');
}
function Loading() {
    document.getElementById("light").style.display = "block";
    document.getElementById("fade").style.display = "block";
}
function CloseLoading() {
    var lightDiv = document.getElementById("light");
    lightDiv.style.display = "none";
    //lightDiv.innerHTML = "发送成功！";
    document.getElementById("fade").style.display = "none";
    
}